package com.softeem.score.manager.service.impl;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.softeem.score.manager.mapper.CollegeMapper;
import com.softeem.score.manager.service.CollegeService;
import com.softeem.score.model.entity.CollegeEntity;
import com.softeem.score.model.entity.school.College;
import com.softeem.score.model.vo.school.CollegeVo;
import com.softeem.score.model.vo.school.MajorVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author zhu
 * @since 2024-02-14
 */
@Service
public class CollegeServiceImpl implements CollegeService {
    @Autowired
    private CollegeMapper collegeMapper;

    @Override
    public List<CollegeEntity> getAllCollege() {
        return collegeMapper.selectALl();
    }

    @Override
    public PageInfo<CollegeVo> findByPage(MajorVo majorVo, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<CollegeVo> collegeVoList = collegeMapper.findByPage(majorVo);
        return new PageInfo<>(collegeVoList);
    }

    @Override
    public void saveCollege(College college) {
        collegeMapper.saveCollege(college);
    }

    @Override
    public void updateCollege(College college) {
        collegeMapper.updateCollege(college);
    }

    @Override
    public void deleteById(Long collegeId) {
        collegeMapper.deleteById(collegeId);
    }
}
